/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.csm.sim2k11.simulator;

import java.io.Serializable;
import java.util.ArrayList;

/**
 *  
 * @author Santiago Moreno
 */
public abstract class Configuration implements Serializable {

    private static double PM1 = 0.5, PM2 = 0.5;//Probabilidad de elgir el Menu 1 o el Menu 2
    private static int cantCola = 1;//Cantidad Maxima de personas en la cola
    private static double intervalComing = 10; //Intervalo de llegada de clientes
    private static double[] PCP = new double[]{0.25d, 0.25d, 0.25d, 0.25d};//Probabilidad de cantidad de personas por llegada
    private static double timeOrder = 1; //Tiempo de toma del pedido
    private static double TM1 = 10, TM2 = 18; //Tiempo de demora en cocina por cada menu
    private static double timeDeliver = 1; //Tiempo en llevar la comida
    private static double lunchMedia = 1, lunchVariance = 20; //Tiempo de demora de comida (Media y Varianza)
    private static int cantSimulations = 1000; //Cantidad de filas de simulación a realizar
    private static int cantSimulationsBeforeClean = 1000; //Cantidad de simulaciones antes de llamar al GC
    private static ArrayList<int[]> historicResults = new ArrayList<int[]>();

    /**
     * @return the PM1
     */
    public static double getPM1() {
        return PM1;
    }

    /**
     * @param aPM1 the PM1 to set
     */
    public static void setPM1(double aPM1) throws NumberFormatException {
        if (aPM1 > 1 || aPM1 < 0) {
            throw new NumberFormatException("The Probability must be between 1 and 0");
        }
        PM1 = aPM1;
        PM2 = 1 - aPM1;
    }

    /**
     * @return the PM2
     */
    public static double getPM2() {
        return PM2;
    }

    /**
     * @param aPM2 the PM2 to set
     */
    public static void setPM2(double aPM2) throws NumberFormatException {
        if (aPM2 > 1 || aPM2 < 0) {
            throw new NumberFormatException("The Probability must be between 1 and 0");
        }
        PM2 = aPM2;
        PM1 = 1 - aPM2;
    }

    /**
     * @return the cantCola
     */
    public static int getCantCola() {
        return cantCola;
    }

    /**
     * @param aCantCola the cantCola to set
     */
    public static void setCantCola(int aCantCola) {
        cantCola = aCantCola;
    }

    /**
     * @return the intervalComing
     */
    public static double getIntervalComing() {
        return intervalComing;
    }

    /**
     * @param aIntervalComing the intervalComing to set
     */
    public static void setIntervalComing(double aIntervalComing) {
        intervalComing = aIntervalComing;
    }

    /**
     * @return the PCP1
     */
    public static double[] getPCP() {
        return PCP;
    }

    /**
     * @param aPCP1 the PCP1 to set
     */
    public static void setPCP(double[] aPCP) throws NumberFormatException {
        double acum = 0;
        for (int i = 0; i < 4; i++) {
            if (PCP[i] > 1 || PCP[i] < 0) {
                throw new NumberFormatException("The Probability must be between 1 and 0");
            }
            acum += PCP[i];
        }
        if (acum != 1)
            throw new NumberFormatException("The Probability of the 4 clients must be 1 in total");
        PCP = aPCP;
    }

    /**
     * @return the timeOrder
     */
    public static double getTimeOrder() {
        return timeOrder;
    }

    /**
     * @param aTimeOrder the timeOrder to set
     */
    public static void setTimeOrder(double aTimeOrder) {
        timeOrder = aTimeOrder;
    }

    /**
     * @return the TM1
     */
    public static double getTM1() {
        return TM1;
    }

    /**
     * @param aTM1 the TM1 to set
     */
    public static void setTM1(double aTM1) {
        TM1 = aTM1;
    }

    /**
     * @return the TM2
     */
    public static double getTM2() {
        return TM2;
    }

    /**
     * @param aTM2 the TM2 to set
     */
    public static void setTM2(double aTM2) {
        TM2 = aTM2;
    }

    /**
     * @return the timeDeliver
     */
    public static double getTimeDeliver() {
        return timeDeliver;
    }

    /**
     * @param aTimeDeliver the timeDeliver to set
     */
    public static void setTimeDeliver(double aTimeDeliver) {
        timeDeliver = aTimeDeliver;
    }

    /**
     * @return the lunchMedia
     */
    public static double getLunchMedia() {
        return lunchMedia;
    }

    /**
     * @param aLunchMedia the lunchMedia to set
     */
    public static void setLunchMedia(double aLunchMedia) {
        lunchMedia = aLunchMedia;
    }

    /**
     * @return the lunchVariance
     */
    public static double getLunchVariance() {
        return lunchVariance;
    }

    /**
     * @param aLunchVariance the lunchVariance to set
     */
    public static void setLunchVariance(double aLunchVariance) {
        lunchVariance = aLunchVariance;
    }

    /**
     * @return the cantSimulations
     */
    public static int getCantSimulations() {
        return cantSimulations;
    }

    /**
     * @param aCantSimulations the cantSimulations to set
     */
    public static void setCantSimulations(int aCantSimulations) {
        cantSimulations = aCantSimulations;
    }

    /**
     * @return the cantSimulationsBeforeClean
     */
    public static int getCantSimulationsBeforeClean() {
        return cantSimulationsBeforeClean;
    }

    /**
     * @param aCantSimulationsBeforeClean the cantSimulationsBeforeClean to set
     */
    public static void setCantSimulationsBeforeClean(int aCantSimulationsBeforeClean) {
        cantSimulationsBeforeClean = aCantSimulationsBeforeClean;
    }

    /**
     * @return the historicResults
     */
    public static ArrayList<int[]> getHistoricResults() {
        return historicResults;
    }
}
